﻿<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="SupplierEdit.aspx.cs" Inherits="SupplierEdit" Title="Supplier Edit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Supplier - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <data:MultiFormView ID="FormView1" DataKeyNames="SupplierId" runat="server" DataSourceID="SupplierDataSource">
        <EditItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/SupplierFields.ascx" />
        </EditItemTemplatePaths>
        <InsertItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/SupplierFields.ascx" />
        </InsertItemTemplatePaths>
        <EmptyDataTemplate>
            <b>Supplier not found!</b>
        </EmptyDataTemplate>
        <FooterTemplate>
            <asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                Text="Insert" />
            <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                Text="Update" />
            <asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="Cancel" />
        </FooterTemplate>
    </data:MultiFormView>
    <data:SupplierDataSource ID="SupplierDataSource" runat="server" SelectMethod="GetBySupplierId">
        <Parameters>
            <asp:QueryStringParameter Name="SupplierId" QueryStringField="SupplierId" Type="String" />
        </Parameters>
    </data:SupplierDataSource>
    <br />
    <data:EntityGridView ID="GridViewGrn1" runat="server" AutoGenerateColumns="False"
        OnSelectedIndexChanged="GridViewGrn1_SelectedIndexChanged" DataSourceID="GrnDataSource1"
        DataKeyNames="GrnId" AllowMultiColumnSorting="false" DefaultSortColumnName=""
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_Grn.xls" Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'>
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="GrnDate" HeaderText="Grn Date" SortExpression="[GRNDate]" />
            <asp:BoundField DataField="PoId" HeaderText="Po Id" SortExpression="[POId]" />
            <data:HyperLinkField HeaderText="Supplier Id" DataNavigateUrlFormatString="SupplierEdit.aspx?SupplierId={0}"
                DataNavigateUrlFields="SupplierId" DataContainer="SupplierIdSource" DataTextField="SupplierName" />
            <asp:BoundField DataField="PreparedBy" HeaderText="Prepared By" SortExpression="[PreparedBy]" />
            <asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="[Amount]" />
            <asp:BoundField DataField="Vat" HeaderText="Vat" SortExpression="[VAT]" />
            <asp:BoundField DataField="TotalAmount" HeaderText="Total Amount" SortExpression="[TotalAmount]" />
            <asp:BoundField DataField="ExchangeRate" HeaderText="Exchange Rate" SortExpression="[ExchangeRate]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
            <asp:BoundField DataField="IsVoid" HeaderText="Is Void" SortExpression="[IsVoid]" />
            <asp:BoundField DataField="IsComplete" HeaderText="Is Complete" SortExpression="[IsComplete]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Grn Found! </b>
            <asp:HyperLink runat="server" ID="hypGrn" NavigateUrl="~/admin/GrnEdit.aspx">Add New</asp:HyperLink>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <data:GrnDataSource ID="GrnDataSource1" runat="server" SelectMethod="Find" EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:GrnProperty Name="Supplier" />
                <data:GrnProperty Name="WebUser" />
                <%--<data:GrnProperty Name="GrnDetailsCollection" />--%>
                <%--<data:GrnProperty Name="GrnVoid" />--%>
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:SqlParameter Name="Parameters">
                <Filters>
                    <data:GrnFilter Column="SupplierId" QueryStringField="SupplierId" />
                </Filters>
            </data:SqlParameter>
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
        </Parameters>
    </data:GrnDataSource>
    <br />
</asp:Content>
